summaryrefslogtreecommitdiff
path: root/src/pages/[locale]/news/[...slug].astro
blob: a24e65aaf6866f7de14b545548b48c25479f7625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
import Article from '$layouts/Article.astro';
import { getCollection } from 'astro:content';
import { getLocale, getSlug } from '$lib/newsUtils';

export async function getStaticPaths() {
  return (await getCollection('news')).map((entry) => ({
    params: {
      slug: getSlug(entry),
      locale: getLocale(entry),
    },
    props: { entry },
  }));
}

const { entry } = Astro.props;
const { Content } = await entry.render();
---

<Article title={entry.data.title}>
  <section>
    <h1>{entry.data.title}</h1>
    <Content />
  </section>
</Article>